<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>配发周期设置</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <meta name="description" content="网站描述"/>
    <meta name="keywords" content=""/>
    <meta name="author" content="wangl"/>
    <link rel="icon" href="http://ow9lg82yy.bkt.clouddn.com/24f5c360-485d-4a6d-9468-2a61c353cf37.ico">
    <link rel="stylesheet" href="/static/layui/css/layui.css" media="all"/>
    <link rel="stylesheet" href="/static/zTree/v3/css/zTreeStyle/zTreeStyle.css" type="text/css">
    <style type="text/css">
        .layui-form-item .layui-inline {
            width: 33.333%;
            float: left;
            margin-right: 0;
        }

        @media (max-width: 1240px) {
            .layui-form-item .layui-inline {
                width: 100%;
                float: none;
            }
        }

        .layui-form-item .role-box {
            position: relative;
        }

        .layui-form-item .role-box .jq-role-inline {
            height: 100%;
            overflow: auto;
        }

        /***
        *  ztree 图标变成黄色
        */
        .ztree .line {
            line-height: 0;
            border-top: none;
            float: none;
        }

        .ztree li span.button.ico_docu {
            background-position: -110px 0;
            margin-right: 2px;
            vertical-align: top;
        }

        .multiSelect {
            line-height: normal;
            height: auto;
            padding: 4px 10px;
            overflow: hidden;
            min-height: 38px;
            margin-top: -38px;
            left: 0;
            z-index: 99;
            position: relative;
            background: none;
        }

        .multiSelect a {
            padding: 2px 5px;
            background: #908e8e;
            border-radius: 2px;
            color: #fff;
            display: block;
            line-height: 20px;
            height: 20px;
            margin: 2px 5px 2px 0;
            float: left;
        }

        .multiSelect a span {
            float: left;
        }

        .multiSelect a i {
            float: left;
            display: block;
            margin: 2px 0 0 2px;
            border-radius: 2px;
            width: 8px;
            height: 8px;
            background: url(/static/images/close.png) no-repeat center;
            background-size: 65%;
            padding: 4px;
        }

        .multiSelect a i:hover {
            background-color: #545556;
        }

        .layui-field-box a {
            padding: 2px 5px;
            background: #908e8e;
            border-radius: 2px;
            color: #fff;
            display: block;
            line-height: 20px;
            height: 20px;
            margin: 2px 5px 22px 0;
            float: left;
        }

        .layui-field-box a span {
            float: left;
        }

        .boxadd {
            float: left;
            display: block;
            margin: 2px 0 0 2px;
            border-radius: 2px;
            width: 8px;
            height: 8px;
            background-size: 65%;
            padding: 4px;
        }
    </style>
</head>
<body class="childrenBody">
<form id="form" class="layui-form"  method="get" style="width:80%;">
    <div class="layui-form-item">
        <label class="layui-form-label">配发周期设置</label>
        <div class="layui-inline">
            <input type="text" class="layui-input" id="grantIntervalTime" name="grantIntervalTime"
                   placeholder="请设置配发周期(以小时为单位)">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">配发起始时间</label>
        <div class="layui-inline">
            <input type="text" class="layui-input" id="startGrantTime" name="startGrantTime"
                   placeholder="请设置配发起始时间">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">交易货币</label>
        <div class="layui-inline">
            <select id="coinTypeSelect" name="coinTypeId">
            </select>
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-input-block">
            <button type="button" class="layui-btn" onclick="getChange()">立即提交</button>
            <#--<button type="reset" class="layui-btn layui-btn-primary">重置</button>-->
        </div>
    </div>
</form>
<script type="text/javascript" src="/static/js/jquery.min.js"></script>
<script type="text/javascript" src="/static/layui/layui.js"></script>
<script type="text/javascript" src="/static/js/wangEditor.min.js"></script>
<script type="text/javascript" src="/static/zTree/v3/js/jquery.ztree.all-3.5.min.js"></script>
<script type="text/javascript" src="/static/js/common.js"></script>
<script type="text/javascript" src="/static/js/dealParam.js"></script>
<script>

    var coinTypeList = getCoinTypeList();
    var coinTypeOptionList = '';
    printJson(coinTypeList);

    $.each(coinTypeList,function (index, coinType) {
        coinTypeOptionList += '<option value="'+coinType.id+'">'+coinType.name+'</option>';
    });
    var coinTypeSelect = $("#coinTypeSelect");
    coinTypeSelect.append($(coinTypeOptionList));

    function getList() {
        var coinTypeId = $("#coinTypeSelect").val();
        $.ajax({
            async: false,
            url: "/back/dealparam/other/grantIntervalTimeList",
            type: 'get',
            data:{
                coinTypeId:coinTypeId
            },
            success: function (baseDto) {
                dealBaseDto(baseDto, function (baseDto) {
                    list = baseDto.data;
                })
            }
        });
        return list;
    };
    function getChange() {
        var list;
        var grantIntervalTime = $("#grantIntervalTime").val();
        var startGrantTime = $("#startGrantTime").val();
        var coinTypeId = $("#coinTypeSelect").val();
        console.log(coinTypeId);
        $.ajax({
            async: false,
            url: "/back/dealparam/other/grantIntervalTime",
            type: 'get',
            data: {
                grantIntervalTime:grantIntervalTime,
                startGrantTime:startGrantTime,
                coinTypeId:coinTypeId
            },
            success: function (baseDto) {
                dealBaseDto(baseDto, function (baseDto) {

                })
            }
        });

    };


    var list = getList();

    function loadData(list) {
        var grantIntervalTimeDiv = $("#grantIntervalTime");
        grantIntervalTimeDiv.val(list.grantIntervalTime);
        var startGrantTimeDiv = $("#startGrantTime");
        startGrantTimeDiv.val(list.startGrantTime);
    }

    loadData(list);

    layui.use('laydate', function(){
        var laydate = layui.laydate;

        //执行一个laydate实例
        laydate.render({
            elem: '#startGrantTime', //指定元素
            type: 'datetime'
        });
    });

    layui.use('form', function(){
        var form = layui.form;
        form.render('select'); //刷新select选择框渲染
        //监听提交
        form.on('submit(*)', function(data){
            window.location.href='http://localhost:8080/back/dealParam/fee/listpage';
        });
    });


</script>
</body>
</html>